#ifndef MYSQLAPI_H
#define MYSQLAPI_H

#include <string>
#include <vector>

#include "mysql.h"

class MysqlAPI {
   private:
    static MYSQL *mysql_;
    static MYSQL_RES *res_;
    static const char *error_;

   public:
    static std::string database_;
    static std::string host_;
    static std::string user_;
    static std::string password_;

    // connect to the mysql, return weather success
    static bool Connect(const std::string &database);
    // close the connection
    static void Close();
    // execute the mysql sentence, return the error code,
    // 0 for mysql return something within successfully,
    // 1 for mysql return nothing within successfully,
    // 2 for execute fail,
    static int Execute(const std::string &sentence);
    // return the error infomation
    static std::string Error();
    // return the mysql ans
    static std::vector<std::vector<std::string>> Ans();
};

#endif  // MYSQLAPI_H
